package com.lazyben;

import com.lazyben.client.MyClient;
import com.lazyben.util.SpringUtils;
import jdk.nashorn.internal.ir.CallNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ClientApplication implements CommandLineRunner {
//    @Autowired
//    MyClient myClient;

    public static void main(String[] args) {
        SpringApplication.run(ClientApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        for (int i = 0; i < 10; i++) {
            MyClient client = SpringUtils.getBean(MyClient.class, String.valueOf(i));
            new Thread(client).start();
        }
    }
}
